home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / guesst1a / frmmain.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-10-10  |  3.5 KB  |  120 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   3  'Fester Dialog
  4.    Caption         =   "Guess The Number!"
  5.    ClientHeight    =   4620
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5700
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4620
  13.    ScaleWidth      =   5700
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows-Standard
  16.    Begin VB.CommandButton cmdmyNumber 
  17.       Caption         =   "&It's my number"
  18.       Height          =   615
  19.       Left            =   1920
  20.       TabIndex        =   4
  21.       Top             =   3000
  22.       Visible         =   0   'False
  23.       Width           =   1695
  24.    End
  25.    Begin VB.CommandButton cmdHigher 
  26.       Caption         =   "&Higher"
  27.       Height          =   615
  28.       Left            =   3840
  29.       TabIndex        =   3
  30.       Top             =   3000
  31.       Visible         =   0   'False
  32.       Width           =   1695
  33.    End
  34.    Begin VB.CommandButton cmdLower 
  35.       Caption         =   "&Lower"
  36.       Height          =   615
  37.       Left            =   120
  38.       TabIndex        =   2
  39.       Top             =   3000
  40.       Visible         =   0   'False
  41.       Width           =   1575
  42.    End
  43.    Begin VB.CommandButton cmdStart 
  44.       Caption         =   "&Start"
  45.       Height          =   495
  46.       Left            =   1920
  47.       TabIndex        =   1
  48.       Top             =   3960
  49.       Width           =   1695
  50.    End
  51.    Begin VB.Label lblNumber 
  52.       Alignment       =   2  'Zentriert
  53.       BorderStyle     =   1  'Fest Einfach
  54.       Height          =   615
  55.       Left            =   360
  56.       TabIndex        =   5
  57.       Top             =   1560
  58.       Width           =   4935
  59.    End
  60.    Begin VB.Label lblTitel 
  61.       Alignment       =   2  'Zentriert
  62.       Caption         =   "Think of a number!"
  63.       BeginProperty Font 
  64.          Name            =   "MS Sans Serif"
  65.          Size            =   24
  66.          Charset         =   0
  67.          Weight          =   400
  68.          Underline       =   0   'False
  69.          Italic          =   0   'False
  70.          Strikethrough   =   0   'False
  71.       EndProperty
  72.       Height          =   735
  73.       Left            =   720
  74.       TabIndex        =   0
  75.       Top             =   240
  76.       Width           =   4215
  77.    End
  78. Attribute VB_Name = "frmMain"
  79. Attribute VB_GlobalNameSpace = False
  80. Attribute VB_Creatable = False
  81. Attribute VB_PredeclaredId = True
  82. Attribute VB_Exposed = False
  83. Private Try As Integer
  84. Private guessnumber As Integer
  85. Private divisor As Integer
  86. Const maxnumber = 32768
  87. Private Sub cmdHigher_Click()
  88. Try = Try + 1
  89. guessnumber = guessnumber + divisor
  90. divisor = divisor \ 2
  91. lblNumber.Caption = "Is it number" & guessnumber & "?"
  92. End Sub
  93. Private Sub cmdLower_Click()
  94. Try = Try + 1
  95. guessnumber = guessnumber - divisor
  96. divisor = divisor \ 2
  97. lblNumber.Caption = "Is it number" & guessnumber & "?"
  98. End Sub
  99. Private Sub cmdStart_Click()
  100. cmdHigher.Visible = True
  101. cmdLower.Visible = True
  102. cmdStart.Enabled = False
  103. cmdmyNumber.Visible = True
  104. lblTitel.Visible = False
  105. Try = 0
  106. guessnumber = maxnumber \ 2
  107. divisor = maxnumber \ 4
  108. lblNumber.Caption = "Is it number " & guessnumber & "?"
  109. End Sub
  110. Private Sub cmdmynumber_Click()
  111. MsgBox prompt:="Number guessed in " & Try & " tries"
  112. cmdHigher.Visible = False
  113. cmdLower.Visible = False
  114. cmdmyNumber.Visible = False
  115. lblTitel.Visible = True
  116. lblNumber.Caption = ""
  117. cmdStart.Enabled = True
  118. cmdStart.SetFocus
  119. End Sub
  120.